<% @main_header = "#{link_to('Ptrack:', '/')} #{@project.name if @project}: Documents" %>

  <div style="float: left; width: 100%;">
  	<fieldset>
	<legend>All Documents</legend>
	<table>
	<tr>
		<td style="font-weight: bold;">
			Title
		</td>
		<td style="font-weight: bold;">
			File Type
		</td>
		<td style="font-weight: bold;">
			File Name
		</td>
		
		<td></td>
		<td></td>
	</tr>
	<tr>
		<td colspan="7">
			<hr>
		</td>
	</tr>
	<% for document in @documents %>
  	<tr>
    <td><%=h document.name %></td>
	<td><%=document.content_type.nil? ? "-" : h(document.content_type) %></td>
	<td><%=document.filename.nil? ? "-" : h(document.filename) %></td>
	
    <td><%= link_to "Download", :action => "download", :id => document%></td>
	<td><%= link_to("Delete", {:action => "destroy", :id => document}, :post => true, :confirm => "Are you sure want to delete document #{document.name}?")%></td>
	</tr>
 
	<% end %>
	</table>
  	</fieldset>
	<p>
	<%= link_to "Previous page", :action => "index" %>
	</p>
  </div>
